{# A table's Rows tab (overseer_database_browser.rows, db_rows), read like Logs rather than on a card: one row of controls (a filter read as a sentence: a column picked from those it may use, how it compares, a value; each filter then a chip that takes it away; the export), then the rows (``rows_table``; a header orders or sorts them, Wrap opens every line, a click opens a row to where its keys lead), running to the bottom of the pane. Under them the pager, by the table's key where it is ordered by it. #} {% from "components/macros/form.html" import action, search_input, select %} {% from "components/macros/layout.html" import chip %} {% from "components/macros/table.html" import pager %} {% from "pages/overseer/_macros.html" import rows_scroller, wrap_actions, wraps %} {% from "pages/overseer/database/_macros.html" import export_menu, rows_off_note, rows_table %} {% if rows_off %} {{ rows_off_note(rows_off) }} {% else %}
{% for field, given in rows_asked.items() %}{% endfor %} {# The comparisons the column picked allows (``rows_allowed``, the server's one rule): the others hidden as it changes, no request. #}
{{ select("column", rows_filters, blank=None, attrs='x-init="column = $el.value" x-on:change="column = $el.value"') }} {{ select("op", rows_ops, blank=None, attrs='x-effect="const ok = allowed[column] || []; [...$el.options].forEach((o) => { o.hidden = o.disabled = !ok.includes(o.value); }); if (!ok.includes($el.value)) $el.value = ok[0]"') }} {{ search_input("value", placeholder="value", attrs='autocomplete="off"') }} {{ action("Filter", "", type="submit") }}
{% for filter in rows_chips %}{{ chip(filter.label ~ " ×", False, filter.url, hx_replace(filter.url, "#" ~ rows_pane), 'data-filter-chip title="Remove this filter"') }}{% endfor %}
{% if rows is defined %}{{ export_menu("database-rows-body", rows_asked.table) }}{% endif %}{{ wrap_actions("database-rows-body", rows is defined and rows.rows) }}
{% if rows_bad %}

{{ rows_bad }}

{% elif rows_slow %}

{{ rows_slow }} Filter or order by an indexed column to read less.

{% else %} {% call rows_scroller(height="flex-1 min-h-0") %} {{ rows_table(rows, "database-rows-body", rows.key, "No rows" ~ (" match " ~ rows_chips|map(attribute="label")|join(", ") if rows_chips else "") ~ ".", rows_links, rows_sorts) }} {% endcall %} {{ pager(rows_pager, "#" ~ rows_pane) }} {% endif %}
{% endif %}